<% add_decidim_page_title(t("decidim.admin.titles.impersonations")) %>
<div class="card">
  <div class="item_show__header">
    <h1 class="item_show__header-title">
      <%= t "decidim.admin.titles.impersonations" %>
    </h1>
  </div>
  <div class="table-scroll">
    <table class="table-list">
      <thead>
        <tr>
          <th><%= t("models.impersonation_log.fields.admin", scope: "decidim.admin") %></th>
          <th><%= t("models.impersonation_log.fields.user", scope: "decidim.admin") %></th>
          <th><%= t("models.impersonation_log.fields.reason", scope: "decidim.admin") %></th>
          <th><%= t("models.impersonation_log.fields.started_at", scope: "decidim.admin") %></th>
          <th><%= t("models.impersonation_log.fields.ended_at", scope: "decidim.admin") %></th>
          <th><%= t("models.impersonation_log.fields.expired_at", scope: "decidim.admin") %></th>
        </tr>
      </thead>
      <tbody>
        <% @impersonation_logs.each do |impersonation_log| %>
          <tr>
            <td><%= impersonation_log.admin.name %></td>
            <td><%= impersonation_log.user.name %></td>
            <td><%= impersonation_log.reason %></td>
            <td><%= impersonation_log.started_at ? l(impersonation_log.started_at, format: :decidim_short) : nil %></td>
            <td><%= impersonation_log.ended_at ? l(impersonation_log.ended_at, format: :decidim_short) : nil %></td>
            <td><%= impersonation_log.expired_at ? l(impersonation_log.expired_at, format: :decidim_short) : nil %></td>
          </tr>
        <% end %>
      </tbody>
    </table>
  </div>
</div>
<%= paginate @impersonation_logs %>
